home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / filecat.arc / FILECAT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-05-14  |  43.0 KB  |  1,392 lines

  1. {.n finc01}
  2. {.n finc02}
  3.  
  4. {$C-}
  5.  
  6. PROGRAM FILECAT; { Written 2/2/86 by Kenn Flee, Madison WI }
  7.                  { Requires Turbo 3.X and Database ToolBox }
  8.                  { Copyright (C) 1986 by Jamestown Software}
  9.                  { NonCommercial use only................. }
  10.  
  11.                  { Configured for TurboPower Extender..... }
  12.  
  13. CONST
  14.   MaxDataRecSize = 600;
  15.   MaxKeyLen      =  20;
  16.   PageSize       =  24;
  17.   Order          =  12;
  18.   PageStackSize  =   8;
  19.   MaxHeight      =   5;
  20.  
  21. {.L-}
  22.  
  23. {$I ACCESS.BOX}
  24. {$I GETKEY.BOX}
  25. {$I ADDKEY.BOX}
  26. {$I DELKEY.BOX}
  27. {$I SORT.BOX}
  28.  
  29. {.L+}
  30.  
  31. TYPE
  32.   Name = String[12];
  33.   Str3 = String[3];
  34.   Str8 = String[8];
  35.   Str11 = String[11];
  36.   Str15 = String[15];
  37.   Str42 = String[42];
  38.   Str79 = String[79];
  39.   Str80 = String[80];
  40.   Str255 = String[255];
  41.   AnyStr = String[255];
  42.   CharSet = Set of Char;
  43.   Reg = Record case Integer of
  44.           1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer);
  45.           2: (AL,AH,BL,BH,CL,CH,DL,DH          : Byte);
  46.         End;
  47.   FRec = Record
  48.            Status : Integer;
  49.            FileName : Name;
  50.            FileTime : Integer;
  51.            FileDate : Integer;
  52.            FileSize : Array[1..4] of Byte;
  53.            Floppy : Boolean;
  54.            VolPath : String[64];
  55.            StandAlone : Boolean;
  56.            ParentName : Name;
  57.            Keys : Str79;
  58.            Description : Array[1..4] of Str79;
  59.          End;
  60.  
  61. E = Record
  62.     EStatus : Integer;
  63.     EName : String[8];
  64.     EExt  : String[3];
  65.     ETime : Integer;
  66.     EDate : Integer;
  67.     ESize : Array[1..4] of Byte;
  68.   End;
  69. EA = Array[1..400] of E;
  70.  
  71. C = Record
  72.     CName : Name;
  73.     CNum  : Integer;
  74.   End;
  75.  
  76.  
  77. VAR
  78.   ExFile : File;
  79.   BadgeFile : Text;
  80.   CapsLock,
  81.   InsertOn : Boolean;
  82.   FileName : Name;
  83.   Ch : Char;
  84.   MenuChoice,
  85.   ReportChoice : Char;
  86.   TDate : Str8;
  87.   CMode,NewMenu,
  88.   InitFiles :Boolean;
  89.   CFile,
  90.   CFile2 : DataFile;
  91.   KIndex,
  92.   CIndex,
  93.   CIndex2 : IndexFile;
  94.   DOSNum : Str3;
  95.   Error : Integer;
  96.   SortKey : Str42;
  97.   SortKey80 : Str80;
  98.   DTA3 : Array[1..43] of Char;
  99.   ASCIIZ : Array[1..64] of Char;
  100.   ASCIIZ2 : Array[1..64] of Char;
  101.   FileRec         : FRec;
  102.   Regs            : Reg;
  103.   OldVolumeName   : String[11];
  104.   OldVolumeNameDate : String[20];
  105.   Drive             : Char;
  106.   EntryDirectory,
  107.   SourceDirectory,
  108.   Directory         : String[80];
  109.   Day,Month,Year,
  110.   Hour,Minute  : Integer;
  111.   Size         : Real;
  112.   AP           : Char;
  113.   Entry        : EA;
  114.   ChildArray   : Array[1..50] of C;
  115.   ChildMatch   : Name;
  116.   ChildCount,
  117.   ChildSelect  : Integer;
  118.   ChildFlag    : Boolean;
  119.   FTemp        : FRec;
  120.   EntryNum     : Integer;
  121.   FKey         : String[14];
  122.   PrintCount   : Integer;
  123.   TransferFile,
  124.   KeySearch    : Boolean;
  125.   FirstCharDelete : Boolean;
  126.  
  127. PROCEDURE BigWindow(a,b,c,d:Integer);
  128.   Begin
  129.     Window(a,b,c,d);
  130.     { delete next line if NOT using Turbo Extender }
  131.     CloneCodeSegment(TurboRunDataStart,TurboRunDataLength);
  132.   End; { procedure BigWindow(a,b,c,d:Integer) }
  133.  
  134. {****************************************************************************}
  135. {                               SCRNCODE.PAS                                 }
  136. {****************************************************************************}
  137.  
  138. CONST  VideoEnable = $08;               { Video Signal Enable Bit }
  139.        On  = True;
  140.        Off = False;
  141.  
  142. TYPE   Imagetype  = Array[1..4000] of char;  { Screen Image }
  143.  
  144. VAR    Screen      : Record
  145.                        Image: Imagetype;
  146.                        X1,Y1:   Integer;
  147.                      End;
  148.        Crtmode     : Byte      ABSOLUTE $0040:$0049;
  149.        Monobuffer  : Imagetype ABSOLUTE $B000:$0000;
  150.        Colorbuffer : Imagetype ABSOLUTE $B800:$0000;
  151.        CrtAdapter  : Integer   ABSOLUTE $0040:$0063;
  152.        VideoMode   : Byte      ABSOLUTE $0040:$0065;
  153.        CurrentSaved : Boolean;
  154.  
  155.  
  156. PROCEDURE Video(Switch:Boolean); { Video On/Off to avoid Read/Write snow }
  157.   Begin
  158.     If (Switch=Off) then Port[CrtAdapter+4] := (VideoMode-VideoEnable)
  159.       Else Port[CrtAdapter+4] := (VideoMode or VideoEnable);
  160.   End;
  161.  
  162. PROCEDURE SaveScreen;
  163.   Begin
  164.     If NOT CurrentSaved then begin
  165.       Video(Off);
  166.       With Screen Do Begin
  167.         X1:=WhereX;
  168.         Y1:=WhereY;
  169.         If CrtMode = 7 then Image := Monobuffer Else Image := Colorbuffer ;
  170.       End;
  171.       Video(On);
  172.       CurrentSaved:=True;
  173.     End;
  174.   End; { procedure SaveScreen }
  175.  
  176. PROCEDURE RestoreScreen;
  177.   Begin
  178.     If CurrentSaved then begin
  179.       Video(Off);
  180.       With Screen Do Begin
  181.         If CrtMode = 7 then Monobuffer := Image Else Colorbuffer := Image;
  182.         GotoXY(X1,Y1);
  183.       End;
  184.       Video(On);
  185.       CurrentSaved:=False;
  186.     End;
  187.   End; { procedure RestoreScreen; }
  188.  
  189. {$I FMAIN01.INC }
  190.  
  191. PROCEDURE Boop;
  192.   Begin
  193.     Sound(330);Delay(120);NoSound;
  194.   End; { procedure Boop }
  195.  
  196. PROCEDURE Parse(VAR EntryStr:AnyStr; VAR ParsedStr:AnyStr);
  197.   VAR I:Integer;
  198.   Begin
  199.     While Pos(' ',EntryStr)=1 do EntryStr:=Copy(EntryStr,2,Length(EntryStr));
  200.     I:=Pos(' ',EntryStr);
  201.     If I=0 then ParsedStr:=EntryStr Else ParsedStr:=Copy(EntryStr,1,I-1);
  202.     If I>0 then EntryStr:=Copy(EntryStr,I+1,Length(EntryStr)) Else EntryStr:='';
  203.   End; { procedure Parse }
  204.  
  205. PROCEDURE OpenFiles;
  206.   Begin
  207.     ChDir(EntryDirectory);
  208.     If TransferFile then begin
  209.       OpenFile(CFile,'TRANSFER.DAT',SizeOf(FRec));
  210.       OpenIndex(CIndex,'TRANSFER.IXN',14,1);
  211.     End Else begin
  212.       OpenFile(CFile,'FILECAT.DAT',SizeOf(FRec));
  213.       OpenIndex(CIndex,'FILECAT.IXN',14,1);
  214.     End;
  215.     OpenIndex(KIndex,'FILECAT.KWD',15,0);
  216.   End; { procedure OpenFiles }
  217.  
  218. PROCEDURE CloseFiles;
  219.   Begin
  220.     ChDir(EntryDirectory);
  221.     CloseFile(CFile);
  222.     CloseIndex(KIndex);
  223.     CloseIndex(CIndex);
  224.   End; { procedure CloseFiles }
  225.  
  226. {.m finc01}
  227.  
  228. {$I FMAIN02.INC}
  229.  
  230. {.m mainmodule}
  231.  
  232. PROCEDURE Show(X,Y:Integer;S:Str80);
  233.   Begin
  234.     GotoXY(X,Y);
  235.     Write(S);
  236.   End; { procedure Show }
  237.  
  238. PROCEDURE ShowScreen;
  239.   Begin
  240.     ClrScr;
  241.     NormVideo;
  242.     Show(1,2,ConstStr(#196,80));
  243.     LowVideo;
  244.     Show(5,2,' FILE INFORMATION ');
  245.     Show( 3, 4,'   File Name:');
  246.     Show( 3, 5,'        Time:');
  247.     Show( 3, 6,'        Date:');
  248.     Show( 3, 7,'        Size:');
  249.     Show( 3, 8,'     Floppy?:');
  250.     Show(21, 8,'Volume/Path:');
  251.     Show( 3, 9,'Stand Alone?:');
  252.     Show(21, 9,'Main File Name:');
  253.     Show(49, 9,'Extension:');
  254.     NormVideo;
  255.     Show(1,11,ConstStr(#196,80));
  256.     Show(1,15,ConstStr(#196,80));
  257.     Show(1,22,ConstStr(#196,80));
  258.     LowVideo;
  259.     Show(5,11,' KEYWORDS ');
  260.     Show(5,15,' DESCRIPTION ');
  261.     NormVideo;
  262.   End; { procedure ShowScreen }
  263.  
  264. PROCEDURE UpdateArray;
  265.   VAR I,R : Integer;
  266.       S1,S2 : String[14];
  267.   Begin
  268.     OpenFiles;
  269.     For I:=1 to EntryNum do begin
  270.       Entry[I].EStatus:=0;
  271.       S1:=Entry[I].EName+Entry[I].EExt;
  272.       FKey:=S1;
  273.       ClearKey(CIndex);
  274.       SearchKey(CIndex,R,FKey);
  275.       If OK then Begin
  276.         S2:=Copy(FKey,1,11);
  277.         If S1=S2 then Entry[I].EStatus:=1;
  278.       End;
  279.     End;
  280.     CloseFiles;
  281.   End; { procedure UpdateArray }
  282.  
  283. PROCEDURE ShowEntry(N:Integer);
  284.   Begin
  285.     With Entry[N] do begin
  286.     GotoXY(17,4);
  287.     Write(EName,'.',EExt);
  288.       Size := (ESize[1] * 1.0) +
  289.               (ESize[2] * 256.0) +
  290.               (ESize[3] * 65536.0);
  291.       Year := (EDate shr 9) + 80;
  292.       Month := (EDate shl 7) shr 12;
  293.       Day := (EDate shl 11) shr 11;
  294.       Hour := ETime shr 11;
  295.       If Hour >= 12 then begin
  296.         AP := 'p';
  297.         Hour := Hour - 12;
  298.       End Else AP := 'a';
  299.       If Hour = 0 then Hour := 12;
  300.       Minute := (ETime shl 5) shr 10;
  301.     End;
  302.     GotoXY(17,5);
  303.     Write(Hour:2,':');
  304.     If Minute < 10 then Write('0');
  305.     Write(Minute,ap);
  306.     GotoXY(17,6);
  307.     Write(Month:2,'-');
  308.     If Day < 10 then Write('0');
  309.     Write(Day,'-',Year);
  310.     GotoXY(17,7);
  311.     Write(Size:0:0);
  312.     GotoXY(17,8);
  313.     If SourceDirectory[1] in ['A','B'] then Write('Yes') Else Write('No');
  314.     GotoXY(34,8);
  315.     If SourceDirectory[1] in ['A','B'] then Write(OldVolumeName)
  316.        Else Write(SourceDirectory);
  317.   End; { procedure ShowEntry }
  318.  
  319. PROCEDURE ShowData(RecNum:Integer);
  320.   VAR I:Integer;
  321.   Begin
  322.     FillChar(FileRec,SizeOf(FileRec),0);
  323.     GetRec(CFile,RecNum,FileRec);
  324.     With FileRec do begin
  325.       GotoXY(17,4);ClrEol;
  326.       Write(FileName);
  327.       GotoXY(60,4);ClrEol;
  328.       Write('Record No.: ',RecNum);
  329.       Size := (FileSize[1] * 1.0) +
  330.               (FileSize[2] * 256.0) +
  331.               (FileSize[3] * 65536.0);
  332.       Year := (FileDate shr 9) + 80;
  333.       Month := (FileDate shl 7) shr 12;
  334.       Day := (FileDate shl 11) shr 11;
  335.       Hour := FileTime shr 11;
  336.       If Hour >= 12 then begin
  337.         AP := 'p';
  338.         Hour := Hour - 12;
  339.       End Else AP := 'a';
  340.       If Hour = 0 then Hour := 12;
  341.       Minute := (FileTime shl 5) shr 10;
  342.       GotoXY(17,5);ClrEol;
  343.       Write(Hour:2,':');
  344.       If Minute < 10 then Write('0');
  345.       Write(Minute,ap);
  346.       GotoXY(17,6);
  347.       Write(Month:2,'-');
  348.       If Day < 10 then Write('0');
  349.       Write(Day,'-',Year);
  350.       GotoXY(17,7);ClrEol;
  351.       Write(Size:0:0);
  352.       GotoXY(17,8);Write(' ');GotoXY(17,8);
  353.       If Floppy then Write('Yes') Else Write('No ');
  354.       GotoXY(34,8);ClrEol;
  355.       Write(VolPath);
  356.       GotoXY(17,9);Write('   ');
  357.       GotoXY(17,9); If StandAlone then Write('Yes') else Write('No ');
  358.       GotoXY(37,9);Write('        ');
  359.       I:=Pos('.',ParentName);
  360.       If I>1 then GotoXY(37,9);Write(Copy(ParentName,1,I-1));
  361.       GotoXY(60,9);ClrEol;
  362.       If I>1 then Write(Copy(ParentName,I+1,Length(ParentName)-I));
  363.       GotoXY(1,13);ClrEol;
  364.       Write(Keys);
  365.       For I:=1 to 4 do begin
  366.         GotoXY(1,I+16);ClrEol;
  367.         Write(Description[I]);
  368.       End;
  369.     End;
  370.   End; { procedure ShowData }
  371.  
  372. PROCEDURE PrintRec;
  373.   VAR I:Integer;
  374.       S:Name;
  375.   Begin
  376.     If not PrTest then Repeat
  377.       Beep;
  378.       SaveScreen;
  379.       DrawBox(10,70,16,21);
  380.       BigWindow(11,17,69,20);
  381.       If MonitorType = 7 then begin
  382.         HideCursor;
  383.         For I:=1 to 4 do begin
  384.           GotoXY(1,I);
  385.           Write(ConstStr(' ',59));
  386.         End;
  387.         RestoreCursor;
  388.       End Else ClrScr;
  389.       HideCursor;
  390.       GotoXY(5,2); WriteLn('Printer does not appear to be ready');
  391.       GotoXY(5,3); WriteLn('Press any key when ready or ESC to return to menu');
  392.       Repeat until KeyPressed;
  393.       Read(Kbd,Ch);
  394.       BigWindow(1,1,80,25);
  395.       RestoreScreen;
  396.       HideCursor;
  397.       If (Ch = #27) and KeyPressed then Read(Kbd,Ch);
  398.       If Ch = #27 then Exit;
  399.     Until PrTest;
  400.     GotoXY(1,1);
  401.     TextColor(7+Blink);
  402.     Write('PRINTING RECORD');
  403.     NormVideo;
  404.     With FileRec do begin
  405.       If PrintCount=0 then WriteLn(Lst,ConstStr('=',79));
  406.       S:=FileName;
  407.       Repeat
  408.         For I:=1 to Length(S) do If S[I]=' ' then Delete(S,I,1);
  409.       Until I=Length(S);
  410.       Write(Lst,S,'   ');
  411.       Size := (FileSize[1] * 1.0) +
  412.               (FileSize[2] * 256.0) +
  413.               (FileSize[3] * 65536.0);
  414.       Year := (FileDate shr 9) + 80;
  415.       Month := (FileDate shl 7) shr 12;
  416.       Day := (FileDate shl 11) shr 11;
  417.       Hour := FileTime shr 11;
  418.       If Hour >= 12 then begin
  419.         AP := 'p';
  420.         Hour := Hour - 12;
  421.       End Else AP := 'a';
  422.       If Hour = 0 then Hour := 12;
  423.       Minute := (FileTime shl 5) shr 10;
  424.       Write(Lst,Size:1:0,' Bytes  ');
  425.       Write(Lst,Hour:2,':');
  426.       If Minute < 10 then Write(Lst,'0');
  427.       Write(Lst,Minute,ap,'  ');
  428.       Write(Lst,Month:2,'-');
  429.       If Day < 10 then Write(Lst,'0');
  430.       Write(Lst,Day,'-',Year,'    ');
  431.       If StandAlone then WriteLn(Lst,'Standalone File') else begin
  432.         S:=ParentName;
  433.         Repeat
  434.           For I:=1 to Length(S) do If S[I]=' ' then Delete(S,I,1);
  435.         Until I=Length(S);
  436.         WriteLn(Lst,'Main File: ',S);
  437.       End;
  438.       WriteLn(Lst,'Located on: ',VolPath);
  439.       WriteLn(Lst,'----Keywords',ConstStr('-',67));
  440.       WriteLn(Lst,Keys);
  441.       WriteLn(Lst,'----Description',ConstStr('-',64));
  442.       For I:=1 to 4 do WriteLn(Lst,Description[I]);
  443.       WriteLn(Lst,ConstStr('=',79));
  444.       PrintCount:=PrintCount+1;
  445.       If PrintCount=6 then begin
  446.         Write(Lst,#12);
  447.         PrintCount:=0;
  448.       End;
  449.     End;
  450.     GotoXY(1,1);Write(ConstStr(' ',20));
  451.   End; { procedure PrintRec }
  452.  
  453. PROCEDURE ShowDuplicate(N:Integer);
  454.   VAR S1,S2:AnyStr;
  455.       RecNum:Integer;
  456.       Done,Printed:Boolean;
  457.   Begin
  458.     FKey:=Entry[N].EName+Entry[N].EExt;
  459.     HideCursor;
  460.     GotoXY(60,1);Write('Duplicate Record!');
  461.     S2:=FKey;
  462.     Printed:=False;
  463.     OpenFiles;
  464.     SearchKey(CIndex,RecNum,FKey);
  465.     S1:=Copy(FKey,1,11);
  466.     Done:=False;
  467.     If Ok and (S1=S2) then begin
  468.       Repeat
  469.         If NOT Printed then ShowData(RecNum);
  470.         Printed:=False;
  471.         GotoXY(1,23);
  472.         Write('Viewing Records Currently Entered in FILECAT Database...');
  473.         GotoXY(9,25);
  474.         Write('<E> Enter New Record for ',Copy(SourceDirectory,1,3),S2,'       <*> Print Record');
  475.         GotoXY(1,24);
  476.         Write('Press:  <N> Next  <P> Previous  <Q> Quit  <D> Delete  ');
  477.         ClrEol;
  478.         Repeat
  479.           Read(Kbd,Ch);
  480.           Ch:=Upcase(Ch);
  481.           If NOT (Ch in ['N','P','Q','D','E','*']) then Boop;
  482.         Until Ch in ['N','P','Q','D','E','*'];
  483.         Case Ch of
  484.           'Q','E' : Done:=True;
  485.           'N' : Begin
  486.                   NextKey(CIndex,RecNum,FKey);
  487.                   GotoXY(1,1);
  488.                   If NOT OK then Write('First Record') else Write(ConstStr(' ',14));
  489.                   If NOT OK then NextKey(CIndex,RecNum,FKey);
  490.                 End;
  491.           'P' : Begin
  492.                   PrevKey(CIndex,RecNum,FKey);
  493.                   GotoXY(1,1);
  494.                   If NOT OK then Write('Last Record ') else Write(ConstStr(' ',14));
  495.                   If NOT OK then PrevKey(CIndex,RecNum,FKey);
  496.                 End;
  497.           'D' : Begin
  498.                   Beep;
  499.                   TextColor(7+Blink);
  500.                   Write('Are you sure? Y/N ');
  501.                   NormVideo;
  502.                   RestoreCursor;
  503.                   If YES then begin
  504.                     DeleteRec(CFile,RecNum);
  505.                     DeleteKey(CIndex,RecNum,FKey);
  506.                     SearchKey(CIndex,RecNum,FKey);
  507.                   End;
  508.                   HideCursor;
  509.                 End;
  510.           '*' : Begin
  511.                   PrintRec;
  512.                   Printed:=True;
  513.                 End;
  514.         End;
  515.       Until Done;
  516.     End;
  517.     CloseFiles;
  518.     RestoreCursor;
  519.   End; { procedure ShowDuplicate }
  520.  
  521. PROCEDURE EnterData;
  522.   VAR I,Line,X,Y:Integer;
  523.       Done:Boolean;
  524.       S,S1:AnyStr;
  525.       ExitSet:CharSet;
  526.       TC:Char;
  527.  
  528.   PROCEDURE Message(S:Str80);
  529.     Begin
  530.       HideCursor;
  531.       GotoXY(1,23);ClrEol;
  532.       LowVideo;
  533.       GotoXY(1,25);Write('Press:    <F4> to clear line     <F10> when entry is complete');
  534.       NormVideo;
  535.       GotoXY(1,24);ClrEol;
  536.       Write(S);
  537.       RestoreCursor;
  538.     End; { procedure Message }
  539.  
  540.   Begin
  541.     Done:=False;
  542.     Line:=1;
  543.     If Length(FTemp.ParentName)<12 then FTemp.ParentName:='        .   ';
  544.     GotoXY(1,25);ClrEol;
  545.     Repeat
  546.       HideCursor;
  547.       X:=WhereX;
  548.       Y:=WhereY;
  549.       GotoXY(77,25);
  550.       If FirstCharDelete then begin
  551.         TextColor(7+Blink);
  552.         Write('FCD');
  553.       End Else Write('   ');
  554.       GotoXY(X,Y);
  555.       RestoreCursor;
  556.       ExitSet:=[#13,^Z,^E,^X];
  557.       Case Line of
  558.         1 : Begin
  559.               GotoXY(17,9);Write('    ');
  560.               Message('Answer <Y>es if no other files are required to run this file.');
  561.               If FTemp.ParentName='        .   ' then FTemp.StandAlone:=True;
  562.               If FTemp.StandAlone then S:='Yes' else S:='No ';
  563.               InputStr(S,1,17,9,Yf,ExitSet,TC);
  564.               If S[1]='Y' then begin
  565.                 FTemp.StandAlone:=True;
  566.                 HideCursor;
  567.                 GotoXY(37,9);Write('        ');
  568.                 GotoXY(60,9);Write('   ');
  569.                 RestoreCursor;
  570.               End else begin
  571.                 FTemp.StandAlone:=False;
  572.                 HideCursor;
  573.                 S:=Copy(FTemp.ParentName,1,8);
  574.                 GotoXY(37,9);Write(S);
  575.                 S:=Copy(FTemp.ParentName,10,3);
  576.                 GotoXY(60,9);Write(S);
  577.                 RestoreCursor;
  578.               End;
  579.             End;
  580.         2 : Begin
  581.               Message('Enter MAIN file name if not standalone.  REPEAT Main file name if also Main.');
  582.               S:=Copy(FTemp.ParentName,1,8);
  583.               InputStr(S,8,37,9,Af,ExitSet,TC);
  584.               For I:= 1 to Length(S) do S[I]:=Upcase(S[I]);
  585.               If Pos('.',S)>0 then begin
  586.                 Boop;
  587.                 S:=Copy(S,1,Pos('.',S)-1);
  588.               End;
  589.               If Length(S)<8 then For I:=1 to 8-(Length(S)) do S:=S+' ';
  590.               GotoXY(37,9);Write(S);
  591.               For I:=1 to 8 do FTemp.ParentName[I]:=S[I];
  592.             End;
  593.         3 : Begin
  594.               Message('Enter MAIN file name extension.');
  595.               S:=Copy(FTemp.ParentName,10,3);
  596.               Repeat
  597.                 If Pos('.',S)>0 then begin
  598.                   Boop;
  599.                   S:='';
  600.                 End;
  601.                 InputStr(S,3,60,9,Af,ExitSet,TC);
  602.                 For I:= 1 to Length(S) do S[I]:=Upcase(S[I]);
  603.               Until Pos('.',S)=0;
  604.               If Length(S)<3 then For I:=1 to 3-(Length(S)) do S:=S+' ';
  605.               GotoXY(60,9);Write(S);
  606.               For I:=1 to 3 do FTemp.ParentName[I+9]:=S[I];
  607.             End;
  608.         4 : Begin
  609.               Message('Enter KEY WORDS, separating with spaces.  (F1 for Keyword List)');
  610.               Repeat
  611.                 S:=FTemp.Keys;
  612.                 InputStr(S,79,1,13,Af,[#13,^Z,^E,^X,^Q],TC);
  613.                 If TC=^Q then begin
  614.                   S1:=SelectKeyword;
  615.                   If S1<>'' then begin
  616.                     If (Length(S)+Length(S1))>78 then Boop
  617.                       Else begin
  618.                         If S='' then S:=S1 Else S:=S+' '+S1;
  619.                       End;
  620.                   End;
  621.                 End;
  622.                 NormVideo;
  623.                 For I:= 1 to Length(S) do S[I]:=Upcase(S[I]);
  624.                 GotoXY(1,13);Write(S);
  625.                 FTemp.Keys:=S;
  626.               Until TC<>^Q;
  627.             End;
  628.         5..8 : Begin
  629.                  Str(Line-4,S);
  630.                  S:='Enter DESCRIPTION of file.  Line '+S+' of 4.';
  631.                  Message(S);
  632.                  S:=FTemp.Description[Line-4];
  633.                  InputStr(S,79,1,12+Line,Af,ExitSet,TC);
  634.                  FTemp.Description[Line-4]:=S;
  635.                End;
  636.       End;
  637.       Case TC of
  638.         #13,^X : Line:=Line+1;
  639.             ^Z : Done:=True;
  640.             ^E : Line:=Line-1;
  641.       End;
  642.       If Line<1 then Line:=5;
  643.       If Line>8 then Line:=1;
  644.       If (Line in [2..3]) and (FTemp.StandAlone=True) then
  645.         If (TC in [#13,^X]) then Line:=4 else
  646.         If TC=^E then Line:=1;
  647.     Until Done;
  648.     Message(' ');
  649.     GotoXY(1,25);ClrEol;
  650.     GotoXY(1,24);ClrEol;
  651.     If FTemp.StandAlone then FTemp.ParentName:='        .   ';
  652.   End; { procedure EnterData }
  653.  
  654. {.m finc02}
  655.  
  656. {$I FMAIN03.INC}
  657.  
  658. {.m mainmodule}
  659.  
  660. PROCEDURE Inp;
  661.   VAR N,I : Integer;
  662.       S,SK:AnyStr;
  663.       S1:String[4];
  664.   Begin
  665.     If ReportChoice<>'c' then begin
  666.       If MonitorType = 7 then begin
  667.         For I:=7 to 25 do begin
  668.           GotoXY(1,I);
  669.           ClrEol;
  670.         End;
  671.       End Else begin
  672.         BigWindow(1,7,80,25);
  673.         ClrScr;
  674.       End;
  675.       BigWindow(1,8,80,24);
  676.       Beep;
  677.       GotoXY(1,1);
  678.       WriteLn('Position printer at beginning of new page.  Press any key when ready.');
  679.       Read(Kbd,Ch);
  680.       HideCursor;
  681.     End;
  682.     OpenFiles;
  683.     For N := 1 to FileLen(CFile)-1 do begin
  684.       GetRec(CFile,N,FTemp);
  685.       If FTemp.Status=0 then begin
  686.         Case ReportChoice of
  687.           '1' : Begin
  688.                   S:=FTemp.Keys;
  689.                   WriteLn(S);
  690.                   While Length(S)>0 do begin
  691.                     Parse(S,SK);
  692.                     SortKey:=SK;
  693.                     If Length(SortKey)>30 then SortKey:=Copy(SortKey,1,30);
  694.                     WriteLn('    ',SortKey);
  695.                     Str(N:4,S1);
  696.                     SortKey:=SortKey+ConstStr(' ',26-Length(SortKey))+FTemp.FileName+S1;
  697.                     SortRelease(SortKey);
  698.                   End;
  699.                 End;
  700.           '3' : Begin
  701.                   SortKey80:=FTemp.VolPath;
  702.                   S:=FTemp.FileName;
  703.                   While Pos(' ',S)>0 do Delete(S,Pos(' ',S),1);
  704.                   Write(S);
  705.                   If FTemp.Floppy then Write(' on diskette ')
  706.                     Else Write(' in ');
  707.                   WriteLn(SortKey80);
  708.                   Str(N:4,S1);
  709.                   SortKey80:=SortKey80+ConstStr(' ',64-Length(SortKey80));
  710.                   SortKey80:=SortKey80+FTemp.FileName+S1;
  711.                   SortRelease(SortKey80);
  712.                 End;
  713.           '4' : If NOT FTemp.StandAlone then Begin
  714.                   SortKey:=FTemp.ParentName;
  715.                   S:=SortKey;
  716.                   While Pos(' ',S)>0 do Delete(S,Pos(' ',S),1);
  717.                   Write(S,' <-- ');
  718.                   SortKey:=SortKey+Ftemp.FileName;
  719.                   S:=FTemp.FileName;
  720.                   While Pos(' ',S)>0 do Delete(S,Pos(' ',S),1);
  721.                   WriteLn(S);
  722.                   Str(N:4,S1);
  723.                   SortKey:=SortKey+ConstStr(' ',38-Length(SortKey));
  724.                   SortKey:=SortKey+S1;
  725.                   SortRelease(SortKey);
  726.                 End;
  727.           '5' : Begin
  728.                   SortKey:=Copy(FTemp.FileName,10,3);
  729.                   WriteLn(SortKey,' <-- ',FTemp.FileName);
  730.                   SortKey:=SortKey+Ftemp.FileName;
  731.                   Str(N:4,S1);
  732.                   SortKey:=SortKey+ConstStr(' ',38-Length(SortKey));
  733.                   SortKey:=SortKey+S1;
  734.                   SortRelease(SortKey);
  735.                 End;
  736.           'c' : If (NOT FTemp.StandAlone) and
  737.                    (FTemp.ParentName=ChildMatch) and
  738.                    (FTemp.ParentName<>FTemp.FileName) then Begin
  739.                   SortKey:=FTemp.ParentName;
  740.                   S:=SortKey;
  741.                   While Pos(' ',S)>0 do Delete(S,Pos(' ',S),1);
  742.                   Str(N:4,S1);
  743.                   SortKey:=SortKey+ConstStr(' ',38-Length(SortKey));
  744.                   SortKey:=SortKey+S1;
  745.                   SortRelease(SortKey);
  746.                 End;
  747.         End; { case ReportChoice}
  748.       End;
  749.     End;
  750.     CloseFiles;
  751.     BigWindow(1,1,80,25);
  752.   End; { procedure Inp }
  753.  
  754. FUNCTION Less;
  755.   VAR First  : Str42 Absolute X;
  756.       Second : Str42 Absolute Y;
  757.       First80  : Str80 Absolute X;
  758.       Second80 : Str80 Absolute Y;
  759.   Begin
  760.     Case ReportChoice of
  761.       '1','4','5','c' : Less:= First<Second;
  762.       '3'             : Less:= First80<Second80;
  763.     End; { case ReportChoice}
  764.   End; { function Less }
  765.  
  766. PROCEDURE OutP;
  767.   CONST Header1 = 'Alphabetical Listing of Keywords and Related Files';
  768.         Header2 = 'Alphabetical Listing of Disks/Directories and Related Files';
  769.         Header3 = 'Alphabetical Listing of Main/Associated File Groups';
  770.         Header4 = 'Files Listed Alphabetically by Extension';
  771.   VAR N,I,Count,Page:Integer;
  772.       S1,S2,S3,Head:Str80;
  773.   Begin
  774.     If ReportChoice <> 'c' then begin
  775.       If MonitorType = 7 then begin
  776.         For I:=7 to 25 do begin
  777.           GotoXY(1,I);
  778.           ClrEol;
  779.         End;
  780.       End Else begin
  781.         BigWindow(1,7,80,25);
  782.         ClrScr;
  783.       End;
  784.       BigWindow(1,8,80,24);GotoXY(1,1);
  785.       WriteLn('---- SORTING COMPLETE, NOW PRINTING --------------');
  786.       WriteLn;
  787.       If NOT PRTest then repeat
  788.         Beep;
  789.         WriteLn('PRINTER NOT READY. Please correct and press any key when ready or ESC to Quit.');
  790.         Read(Kbd,Ch);
  791.         If (Ch=#27) and (NOT Keypressed) then begin
  792.           BigWindow(1,1,80,25);
  793.           Exit;
  794.         End;
  795.       until PRTest;
  796.       HideCursor;
  797.     End;
  798.     OpenFiles;
  799.     S3:='';
  800.     Page:=1;
  801.     Case ReportChoice of
  802.       '1' : Head:=Header1;
  803.       '3' : Head:=Header2;
  804.       '4' : Head:=Header3;
  805.       '5' : Head:=Header4;
  806.     End;
  807.     Head:=Head+' on '+TDate;
  808.     While NOT SortEOS do begin
  809.       If (Page=1) and (ReportChoice<>'c') then begin
  810.         WriteLn(Lst,Head,ConstStr(' ',71-Length(Head)),'Page ',Page);
  811.         WriteLn(Lst,ConstStr('-',79));
  812.         WriteLn(Lst);
  813.         Page:=Page+1;
  814.         Count:=3;
  815.       End;
  816.       Case ReportChoice of
  817.         '1' : Begin
  818.                 SortReturn(SortKey);
  819.                 S2:=Copy(SortKey,1,26);
  820.                 If S2<>S3 then begin
  821.                   WriteLn(Lst,S2);
  822.                   Count:=Count+1;
  823.                   S3:=S2;
  824.                 End;
  825.                 S1:=Copy(SortKey,39,4);
  826.                 While S1[1]=' ' do S1:=Copy(S1,2,Length(S1));
  827.                 Val(S1,N,I);
  828.                 GetRec(CFile,N,FTemp);
  829.                 S1:=FTemp.FileName;
  830.                 While Pos(' ',S1)>0 do Delete(S1,Pos(' ',S1),1);
  831.                 WriteLn('-> ',S2,S1);
  832.                 If FTemp.Floppy then WriteLn(Lst,'   ',S1,' on diskette ',FTemp.VolPath)
  833.                   Else WriteLn(Lst,'   ',S1,' in subdirectory ',FTemp.VolPath);
  834.                 Count:=Count+1;
  835.               End;
  836.         '3' : With FTemp do begin
  837.                 SortReturn(SortKey80);
  838.                 S2:=Copy(SortKey80,1,64);
  839.                 If S2<>S3 then begin
  840.                   S3:=S2;
  841.                   WriteLn(Lst,S2);
  842.                   Count:=Count+1;
  843.                 End;
  844.                 S1:=Copy(SortKey80,77,4);
  845.                 While S1[1]=' ' do S1:=Copy(S1,2,Length(S1));
  846.                 Val(S1,N,I);
  847.                 GetRec(CFile,N,FTemp);
  848.                 S1:=FileName;
  849.                 While Pos(' ',S1)>0 do Delete(S1,Pos(' ',S1),1);
  850.                 WriteLn('-> ',S1);
  851.                 Write(Lst,'   ',S1,ConstStr(' ',12-Length(S1)));
  852.                 Size := (FileSize[1] * 1.0) +
  853.                         (FileSize[2] * 256.0) +
  854.                         (FileSize[3] * 65536.0);
  855.                 Year := (FileDate shr 9) + 80;
  856.                 Month := (FileDate shl 7) shr 12;
  857.                 Day := (FileDate shl 11) shr 11;
  858.                 Hour := FileTime shr 11;
  859.                 If Hour >= 12 then begin
  860.                   AP := 'p';
  861.                   Hour := Hour - 12;
  862.                 End Else AP := 'a';
  863.                 If Hour = 0 then Hour := 12;
  864.                 Minute := (FileTime shl 5) shr 10;
  865.                 Write(Lst,Size:8:0,' Bytes',Hour:4,':');
  866.                 If Minute < 10 then Write(Lst,'0');
  867.                 Write(Lst,Minute,ap,Month:4,'-');
  868.                 If Day < 10 then Write(Lst,'0');
  869.                 Write(Lst,Day,'-',Year,'   ');
  870.                 If StandAlone then WriteLn(Lst,'Standalone File') else begin
  871.                   S1:=ParentName;
  872.                   While Pos(' ',S1)>0 do Delete(S1,Pos(' ',S1),1);
  873.                   WriteLn(Lst,'Main File: ',S1);
  874.                 End;
  875.                 Count:=Count+1;
  876.               End;
  877.     '4','5' : Begin
  878.                 SortReturn(SortKey);
  879.                 If ReportChoice='4' then S2:=Copy(SortKey,1,12);
  880.                 If ReportChoice='5' then S2:=Copy(SortKey,1,3);
  881.                 If S2<>S3 then begin
  882.                   S3:=S2;
  883.                   While S2[1]=' ' do S2:=Copy(S2,2,Length(S1));
  884.                   If ReportChoice='4' then WriteLn(Lst,S2);
  885.                   If ReportChoice='5' then WriteLn(Lst);
  886.                   Count:=Count+1;
  887.                 End;
  888.                 S1:=Copy(SortKey,39,4);
  889.                 While S1[1]=' ' do S1:=Copy(S1,2,Length(S1));
  890.                 Val(S1,N,I);
  891.                 GetRec(CFile,N,FTemp);
  892.                 S1:=FTemp.FileName;
  893.                 While Pos(' ',S1)>0 do Delete(S1,Pos(' ',S1),1);
  894.                 WriteLn('-> ',S1);
  895.                 If FTemp.Floppy then WriteLn(Lst,'   ',S1,' on diskette ',FTemp.VolPath)
  896.                   Else WriteLn(Lst,'   ',S1,' in subdirectory ',FTemp.VolPath);
  897.                 Count:=Count+1;
  898.               End;
  899.         'c' : Begin
  900.                 SortReturn(SortKey);
  901.                 If ChildCount<150 then begin
  902.                   ChildCount:=ChildCount+1;
  903.                   ChildArray[ChildCount].CName:=Copy(SortKey,1,12);
  904.                   S1:=Copy(SortKey,39,4);
  905.                   While S1[1]=' ' do S1:=Copy(S1,2,Length(S1));
  906.                   Val(S1,N,I);
  907.                   ChildArray[ChildCount].CNum:=N;
  908.                 End;
  909.               End;
  910.       End; { case ReportChoice}
  911.       If (Count>=55) and (ReportChoice<>'c') then begin
  912.         Write(Lst,#12);
  913.         WriteLn(Lst,Head,ConstStr(' ',71-Length(Head)),'Page ',Page);
  914.         WriteLn(Lst,ConstStr('-',79));
  915.         WriteLn(Lst);
  916.         Page:=Page+1;
  917.         Count:=3;
  918.       End;
  919.     End;
  920.     If ReportChoice<>'c' then Write(Lst,#12);
  921.     CloseFiles;
  922.     BigWindow(1,1,80,25);
  923.   End; { procedure OutP }
  924.  
  925. PROCEDURE ReportMenu;
  926.   CONST N = 15;
  927.   VAR S:Str80;
  928.       I:Integer;
  929.       NewReportMenu:Boolean;
  930.   Begin
  931.   NewReportMenu:=False;
  932.   Repeat
  933.     If NewReportMenu then DisplayID Else Begin
  934.       If MonitorType = 7 then begin
  935.         For I:=7 to 25 do begin
  936.           GotoXY(1,I);
  937.           ClrEol;
  938.         End;
  939.       End Else begin
  940.         BigWindow(1,7,80,25);
  941.         ClrScr;
  942.       End;
  943.       BigWindow(1,1,80,25);
  944.     End;
  945.     NewReportMenu:=False;
  946.     NormVideo;
  947.     GotoXY(26,08); Write('REPORTS and UTILITIES MENU');
  948.     GotoXY(N,10); WriteLn('1 -- PRINT Listing of Keywords and Related Files');
  949.     GotoXY(N,11); WriteLn('2 -- PRINT Alphabetical List of All Files');
  950.     GotoXY(N,12); WriteLn('3 -- PRINT Listing of Disks and Related Files');
  951.     GotoXY(N,13); WriteLn('4 -- PRINT Listing of Main/Associated File Groups');
  952.     GotoXY(N,14); WriteLn('5 -- PRINT Files Listed Alphabetically by Extension');
  953.     GotoXY(N,15);
  954.     If TransferFile then
  955.       WriteLn('6 -- MOVE Transfer File to Current Source Drive')
  956.     Else WriteLn('6 -- CREATE and WRITE to Transfer File');
  957.  
  958.     GotoXY(N,17); WriteLn('7 -- TEST SOURCE Diskette for Duplicates');
  959.     GotoXY(N,18); WriteLn('8 -- TEST FILECAT Database for Duplicates');
  960.     GotoXY(N,20); WriteLn('C -- PRINT Disk Catalog / Compare Active Files');
  961.  
  962.     LowVideo;
  963.     GotoXY(N,22); WriteLn('9 -- Return to MAIN MENU');
  964.     NormVideo;
  965.     GotoXY(N,24); Write('Enter your selection: [ ]');
  966.     Repeat
  967.       GotoXY(N+23,WhereY);
  968.       Read(Kbd,ReportChoice);
  969.       Write(ReportChoice);
  970.       Case ReportChoice of
  971.         'c','C' : Begin
  972.                     DiskCatalog;
  973.                     NewMenu:=True;
  974.                   End;
  975.         '1',
  976.         '4',
  977.         '5' : Begin
  978.                 I:=TurboSort(SizeOf(SortKey));
  979.                 NewReportMenu:=True;
  980.               End;
  981.         '2' : Begin
  982.                 PrintAll;
  983.                 If PrintCount<>0 then Write(Lst,#12);
  984.                 PrintCount:=0;
  985.                 NewReportMenu:=True;
  986.               End;
  987.         '3' : Begin
  988.                 I:=TurboSort(SizeOf(SortKey80));
  989.                 NewReportMenu:=True;
  990.               End;
  991.         '6' : Begin
  992.                 If MonitorType = 7 then begin
  993.                   For I:=7 to 25 do begin
  994.                     GotoXY(1,I);
  995.                     ClrEol;
  996.                   End;
  997.                 End Else begin
  998.                   BigWindow(1,7,80,25);
  999.                   ClrScr;
  1000.                 End;
  1001.                 BigWindow(1,1,80,25);
  1002.                 NewReportMenu:=True;
  1003.                 If NOT TransferFile then begin
  1004.                   GotoXY(28,14); Write('Creating Transfer File...');
  1005.                   ChDir(EntryDirectory);
  1006.                   MakeFile(CFile,'TRANSFER.DAT',SizeOf(FRec));
  1007.                   MakeIndex(CIndex,'TRANSFER.IXN',14,1);
  1008.                   CloseFile(CFile);
  1009.                   CloseIndex(CIndex);
  1010.                   TransferFile:=True;
  1011.                 End Else begin
  1012.                   GotoXY(10,13);
  1013.                   HideCursor;
  1014.                   Write('Do you wish to MOVE the transfer file to ',SourceDirectory,'? Y/N');
  1015.                   If YES then begin
  1016.                     MoveFiles;
  1017.                     GotoXY(10,13); ClrEol;
  1018.                     Write('ADD the transfer file data to the master database? Y/N');
  1019.                     IF YES then begin
  1020.                       S:=EntryDirectory;
  1021.                       If S[Length(S)]<>'\' then S:=S+'\';
  1022.                       AddTransfer(S);
  1023.                     End;
  1024.                     DeleteTransfer;
  1025.                     TransferFile:=False;
  1026.                   End;
  1027.                 End;
  1028.               End;
  1029.         '7' : Begin
  1030.                 INT24On;
  1031.                 {$I-}
  1032.                 ChDir(SourceDirectory);
  1033.                 {$I+}
  1034.                 I:=INT24Result;
  1035.                 INT24Off;
  1036.                 If I=0 then begin
  1037.                   BuildArray;
  1038.                   QuickSortRecord(Entry,EntryNum);
  1039.                   If EntryNum>0 then TestIt;
  1040.                 End Else Boop;
  1041.                 ChDir(EntryDirectory);
  1042.               End;
  1043.         '8' : Begin
  1044.                 ChDir(EntryDirectory);
  1045.                 TestIt2;
  1046.               End;
  1047.         '9' : ;
  1048.       Else Boop;
  1049.       End;
  1050.     Until ReportChoice in ['1'..'9','C','c'];
  1051.   Until ReportChoice in ['6'..'9','C','c'];
  1052.   End;  { procedure ReportMenu }
  1053.  
  1054. PROCEDURE KillTemp;
  1055.   Begin
  1056.     If Exist('FILECAT.TMP') then begin
  1057.       Assign(ExFile,'FILECAT.TMP');
  1058.       Erase(ExFile);
  1059.     End;
  1060.   End; { procedure KillTemp }
  1061.  
  1062. PROCEDURE Menu;
  1063.   LABEL NameIt;
  1064.   CONST N = 20;
  1065.   VAR S:Str80;
  1066.       I:Integer;
  1067.       R:Real;
  1068.  
  1069.   PROCEDURE GetVolumeName;
  1070.     Begin
  1071.       INT24On;
  1072.       {$I-}
  1073.       ChDir(SourceDirectory);
  1074.       {$I+}
  1075.       I:=INT24Result;
  1076.       INT24Off;
  1077.       If I<>0 then Begin
  1078.         Beep;
  1079.         GotoXY(30,9);ClrEol;
  1080.         Write(SourceDirectory,' Drive Not Ready');
  1081.         OldVolumeName:='<NONE>';
  1082.         OldVolumeNameDate:='';
  1083.       End Else Volume(SourceDirectory[1],False);
  1084.       ChDir(EntryDirectory);
  1085.       LowVideo;
  1086.       GotoXY(17,10); ClrEol;
  1087.       Write('Volume Name: ',OldVolumeName,'   ',OldVolumeNameDate);
  1088.     End; { procedure GetVolumeName }
  1089.  
  1090.   Begin
  1091.   Repeat
  1092.     NormVideo;
  1093.     If NewMenu then DisplayID Else Begin
  1094.       If MonitorType = 7 then begin
  1095.         For I:=7 to 25 do begin
  1096.           GotoXY(1,I);
  1097.           ClrEol;
  1098.         End;
  1099.       End Else begin
  1100.         BigWindow(1,7,80,25);
  1101.         ClrScr;
  1102.       End;
  1103.       BigWindow(1,1,80,25);
  1104.     End;
  1105.     For I:=1 to Length(EntryDirectory) do
  1106.       EntryDirectory[I]:=UpCase(EntryDirectory[I]);
  1107.     Repeat
  1108.       S:=EntryDirectory;
  1109.       If EntryDirectory[Length(EntryDirectory)]='\'then
  1110.         S := S + 'FILECAT.DAT' Else
  1111.         S := S + '\FILECAT.DAT';
  1112.       If NOT Exist(S) then begin
  1113.         GotoXY(5,12);
  1114.         Write('Please place the');
  1115.         GotoXY(5,13);
  1116.         Write('FILECAT data disk in ',EntryDirectory);
  1117.         GotoXY(5,16);
  1118.         Beep;
  1119.         HideCursor;
  1120.         Write('Press  <Y>  to create new files on ',EntryDirectory[1],':');
  1121.         GotoXY(5,17);
  1122.         Write('      <ESC> to Quit and return to DOS');
  1123.         GotoXY(5,18);
  1124.         Write('       <C>  to continue...');
  1125.         Repeat
  1126.           Read(Kbd,Ch);
  1127.           If (Ch=#27) and Keypressed then Read(Kbd,Ch);
  1128.           Ch:=Upcase(Ch);
  1129.           Case Ch of
  1130.             #27 : Begin
  1131.                     ClrScr;
  1132.                     RestoreCursor;
  1133.                     Halt;
  1134.                   End;
  1135.             'Y' : Begin
  1136.                     KillTemp;
  1137.                     InitializeFiles;
  1138.                   End;
  1139.             'C' : ;
  1140.             Else Boop;
  1141.           End;
  1142.         Until Ch in ['C','Y',#27];
  1143.         RestoreCursor;
  1144.         If MonitorType = 7 then begin
  1145.           For I:=7 to 25 do begin
  1146.             GotoXY(1,I);
  1147.             ClrEol;
  1148.           End;
  1149.         End Else begin
  1150.           BigWindow(1,7,80,25);
  1151.           ClrScr;
  1152.         End;
  1153.         BigWindow(1,1,80,25);
  1154.       End;
  1155.     until Exist(S);
  1156.     R:=FreeSpace;
  1157.  
  1158.     LowVideo;
  1159.     HideCursor;
  1160.     GotoXY(10,8); Write('FILECAT Resides on: ',EntryDirectory);
  1161.     If R<2000.0 then NormVideo;
  1162.     GotoXY(1,25); Write(R:1:0,' Left on ',EntryDirectory);
  1163.     If R<2000.00 then begin
  1164.       Beep;
  1165.       Textcolor(7+Blink);
  1166.       Write(' <--Disk almost full!');
  1167.       Delay(2000);
  1168.       LowVideo;
  1169.     End;
  1170.     If TransferFile then begin
  1171.       Beep;
  1172.       Textcolor(7+Blink);
  1173.       GotoXY(49,25);
  1174.       Write('> WORKING ON A TRANSFER FILE <');
  1175.       LowVideo;
  1176.     End;
  1177.     GotoXY(70,8); Write('DOS: ',DOSNum);
  1178.     GotoXY(6,9); ClrEol; Write('Source Drive/Directory: ',SourceDirectory);
  1179.     OldVolumeName := '';
  1180.     OldVolumeNameDate := '';
  1181.     NormVideo;
  1182.     GotoXY(N,12); WriteLn('1 -- CHANGE Source Drive/Directory');
  1183.     GotoXY(N,13); WriteLn('2 -- ENTER New File Data');
  1184.     GotoXY(N,14); WriteLn('3 -- SEARCH Database for KEYWORD MATCH');
  1185.     GotoXY(N,15); WriteLn('4 -- BROWSE/EDIT Database Records');
  1186.     GotoXY(N,16); WriteLn('5 -- REPORTS and UTILITIES');
  1187.     GotoXY(N,17); WriteLn('6 -- LABEL Source Diskette');
  1188.     LowVideo;
  1189.     GotoXY(N,19); WriteLn('7 -- Set Epson Print Codes');
  1190.     GotoXY(N,20); WriteLn('8 -- Change Color');
  1191.     GotoXY(N,21); WriteLn('9 -- End');
  1192.     If SourceDirectory[1] in ['A','B'] then begin
  1193.       GetVolumeName;
  1194.       If I=0 then begin
  1195.         ChDir(SourceDirectory);
  1196.         If Exist('TRANSFER.DAT') then begin
  1197.           GotoXY(1,11);
  1198.           NormVideo;
  1199.           Beep;
  1200.           Write('TRANSFER file found on Source Directory...');
  1201.           Delay(2000);
  1202.           Beep;
  1203.           Write(' Add to master database?  Y/N ');
  1204.           LowVideo;
  1205.           If YES then Begin
  1206.             S:=SourceDirectory;
  1207.             If S[Length(S)]<>'\' then S:=S+'\';
  1208.             S:=S+'TRANSFER.DXT';
  1209.             If Exist(S) then begin
  1210.               Assign(ExFile,S);
  1211.               Erase(ExFile);
  1212.             End;
  1213.             S:=SourceDirectory;
  1214.             If S[Length(S)]<>'\' then S:=S+'\';
  1215.             AddTransfer(S);
  1216.             GotoXY(1,11); ClrEol;
  1217.             GotoXY(10,11); Write('Transfer complete...TRANSFER.DAT renamed to TRANSFER.DXT');
  1218.             S:=S+'TRANSFER.DAT';
  1219.             Assign(ExFile,S);
  1220.             S:=SourceDirectory;
  1221.             If S[Length(S)]<>'\' then S:=S+'\';
  1222.             S:=S+'TRANSFER.DXT';
  1223.             Rename(ExFile,S);
  1224.           End Else begin
  1225.             GotoXY(1,11);
  1226.             ClrEol;
  1227.           End;
  1228.         End;
  1229.       End;
  1230.       ChDir(EntryDirectory);
  1231.       NormVideo;
  1232.     End;
  1233.     NormVideo;
  1234.     GotoXY(N,23); Write('Enter your selection: [ ]');
  1235.     KeySearch:=False;
  1236.     Repeat
  1237.       ReStoreCursor;
  1238.       GotoXY(N+23,WhereY);
  1239.       Read(Kbd,MenuChoice);
  1240.       Write(MenuChoice);
  1241.       If MenuChoice in ['2'..'5'] then begin
  1242.         Repeat
  1243.           INT24On;
  1244.           {$I-}
  1245.           ChDir(EntryDirectory);
  1246.           {$I+}
  1247.           I:=INT24Result;
  1248.           INT24Off;
  1249.           If I<>0 then Begin
  1250.             Beep;
  1251.             GotoXY(30,8);ClrEol;
  1252.             Write(EntryDirectory,' Drive Not Ready');
  1253.             Read(Kbd,Ch);
  1254.           End;
  1255.         Until I=0;
  1256.         If (NOT Exist('FILECAT.DAT')) or
  1257.            (NOT Exist('FILECAT.IXN')) then Menu;
  1258.         If (Exist('TRANSFER.DAT')) and
  1259.            (Exist('TRANSFER.IXN')) then TransferFile:=True Else TransferFile:=False;
  1260.       End;
  1261.       Case MenuChoice of
  1262.         '1' : Begin                          { Change Directory }
  1263.                 NewMenu:=False;
  1264.                 S := '';
  1265.                 GotoXY(30,9); ClrEol;
  1266.                 ReadLn(S);
  1267.                 If Length(S)=1 then S:=S+':';
  1268.                 If Length(S)=2 then S:=S+'\';
  1269.                 INT24On;
  1270.                 {$I-}
  1271.                 ChDir(S);
  1272.                 {$I+}
  1273.                 For I:=1 to Length(S) do S[I]:=UpCase(S[I]);
  1274.                 I:=INT24Result;
  1275.                 INT24Off;
  1276.                 If (I<>0) or (S='') then Begin
  1277.                   Beep;
  1278.                   GotoXY(30,9);
  1279.                   Write('Drive Not Ready or Illegal Definition');
  1280.                   Delay(3000);
  1281.                 End Else SourceDirectory:=S;
  1282.                 LowVideo;
  1283.                 GotoXY(10,9); WriteLn('  Source Directory: ',SourceDirectory);
  1284.                 NormVideo;
  1285.                 ChDir(EntryDirectory);
  1286.               End;
  1287.         '2' : Begin
  1288.                 NewMenu:=True;
  1289.                 If SourceDirectory[1] in ['A','B'] then GetVolumeName;
  1290.                 INT24On;
  1291.                 {$I-}
  1292.                 ChDir(SourceDirectory);
  1293.                 {$I+}
  1294.                 I:=INT24Result;
  1295.                 INT24Off;
  1296.                 If I=0 then begin
  1297.                   BuildArray;
  1298.                   If EntryNum>0 then DoEntry;
  1299.                   KillTemp;
  1300.                 End Else Begin
  1301.                   Beep;
  1302.                   GotoXY(30,9); ClrEol;
  1303.                   Write(SourceDirectory,' Drive Not Ready');
  1304.                   Delay(3000);
  1305.                 End;
  1306.                 ChDir(EntryDirectory);
  1307.               End;
  1308.         '3' : Begin
  1309.                 KeySearch:=True;
  1310.                 BrowseEdit;
  1311.                 NewMenu:=True;
  1312.               End;
  1313.         '4' : Begin
  1314.                 BrowseEdit;
  1315.                 NewMenu:=True;
  1316.               End;
  1317.         '5' : Begin
  1318.                 NewMenu:=False;
  1319.                 ReportMenu;
  1320.               End;
  1321.         '6' : If SourceDirectory[1] in ['A','B'] then begin
  1322.                 Volume(SourceDirectory[1],True);
  1323.                 GetVolumeName;
  1324.                 NewMenu:=False;
  1325.               End;
  1326.         '7' : Begin
  1327.                 SetEpson;
  1328.                 NewMenu:=False;
  1329.               End;
  1330.         '8' : Begin
  1331.                 CMode:=Not Cmode;
  1332.                 If CMode then TextMode(3) Else TextMode(2);
  1333.                 NewMenu:=True;
  1334.                 Menu;
  1335.               End;
  1336.         '9' : If TransferFile then begin
  1337.                 If MonitorType = 7 then begin
  1338.                   For I:=7 to 25 do begin
  1339.                     GotoXY(1,I);
  1340.                     ClrEol;
  1341.                   End;
  1342.                 End Else begin
  1343.                   BigWindow(1,7,80,25);
  1344.                   ClrScr;
  1345.                 End;
  1346.                 BigWindow(1,1,80,25);
  1347.                 HideCursor;
  1348.                 Beep;
  1349.                 GotoXY(22,12);
  1350.                 Write('TRANSFER FILE CREATED and NOT MOVED!');
  1351.                 GotoXY(24,14);
  1352.                 Write('Do you still wish to EXIT?  Y/N');
  1353.                 If NOT YES then Menu;
  1354.               End;
  1355.       Else Boop;
  1356.       End;
  1357.     Until MenuChoice in ['1'..'9'];
  1358.   Until MenuChoice = '9';
  1359.   End;
  1360.  
  1361. Begin
  1362.   InitIndex;
  1363.   KillTemp;
  1364.   PrintCount:=0;
  1365.   DOSNum:=CheckDosVersion;
  1366.   If MonitorType = 7 then begin
  1367.     TextMode(2);
  1368.     CMode:=False;
  1369.   End Else begin
  1370.     TextMode(3);
  1371.     CMode:=True;
  1372.   End;
  1373.   TDate := DOSDate;
  1374.   GetDir(0,EntryDirectory);
  1375.   OvrPath(EntryDirectory);
  1376.   If EntryDirectory[1]='A' then SourceDirectory:='B:\'
  1377.     Else SourceDirectory:='A:\';
  1378.   OldVolumeName:='';
  1379.   InitFiles:=False;
  1380.   If (Exist('TRANSFER.DAT')) and
  1381.      (Exist('TRANSFER.IXN')) then TransferFile:=True Else TransferFile:=False;
  1382.   NewMenu:=True;
  1383.   FirstCharDelete:=False;
  1384.   CurrentSaved:=False;
  1385.   KillTemp;
  1386.   Menu;
  1387.   ReStoreCursor;
  1388.   ClrScr;
  1389.   Beep;
  1390.   KillTemp;
  1391.   Goodbye;
  1392. End.